package demo;

import java.io.*;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 利用Scanner进行读取
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2024-03-27  19:42
 */
public class IODemo12 {
    public static void main(String[] args) throws FileNotFoundException {
        try(InputStream inputStream = new FileInputStream("./text.txt")) {
            Scanner scanner = new Scanner(inputStream);
            while(scanner.hasNext()) {
                String str = scanner.next();
                System.out.println(str);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } ;

    }
}
